package com.mybatisplus.demo.design_patterns.section_6;

/**
 * 单例模式 饿汉式
 */
public class Singleton {

    private static Singleton instance = new Singleton();

    private Singleton() {
    }

    private static Singleton getInstance() {
        return instance;
    }

    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        System.out.println(s1.equals(s2));

    }
}
